﻿@inject IJSRuntime _jsRuntime
@inject IStringLocalizerAsync<DeleteEntityButton> Localizer
<AuthorizeView Policy="@SharedConstants.WRITERPOLICY">
    <Authorized>
        <!-- Button trigger modal -->
        <button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#delete-entity">
            <span class="oi oi-trash"></span>
            @Localizer["Delete"]
        </button>

        <!-- Modal -->
        <div class="modal fade" id="delete-entity" tabindex="-1" role="dialog" aria-labelledby="delete-modal-header" aria-hidden="true" data-bs-backdrop="false">
            <div class="modal-dialog modal-dialog-centered" role="document">
                <div class="modal-content">
                    <div class="modal-header bg-danger text-white">
                        <h5 class="modal-title" id="delete-modal-header">@Localizer["Remove"]</h5>
                        <button type="button" class="btn-close text-white" data-bs-dismiss="modal" aria-label="@Localizer["Close"]">
                        </button>
                    </div>
                    <div class="modal-body">
                        <div class="row">
                            <p class="col text-danger">
                                @(new MarkupString(Localizer["Retype the \"{0}\" if you are sure to delete it.", EntityId]))
                            </p>
                        </div>
                        <div class="row">
                            <div class="col">
                                <InputText class="form-control" @bind-Value="@_checkEntityId" />
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-danger" @onclick="OnDeleteClicked">@Localizer["Delete"]</button>
                    </div>
                </div>
            </div>
        </div>
    </Authorized>
</AuthorizeView>
